<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@taglib uri="http://java.sun.com/jsp/jstl/core"  prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="${pageContext.request.contextPath }/webjars/jquery/1.12.4/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/listTable.js"></script>
<link rel="stylesheet" href="${pageContext.request.contextPath }/css/editTablestyles.css">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<body>
	<form action="books.action?methodName=toAddBooks" method="post">
	<table class="querytable">
		<tr>
			<th class="textright">图书种类：</th>
			<td class="textright">
				<select name="typeid" id="">
					<option value="0">--请选择--</option>
					<c:forEach items="${tlist }" var="type">
						<option value="${type.typeid }">${type.typename}</option>
					</c:forEach>
				</select>
			</td>
			<th class="textright">图书名称</th>
			<th class="textleft">
				<input type="text" name="bookname">
			</th>
		</tr>
		<tr>
			<td colspan="4" align="center">
				<input type="button" value="查询图书信息">
			</td>
		</tr>
	</table>
	<br />
	<table class="querytable">
		<tr>
			<th>图书名称</th>
			<th>图书出版社</th>
			<th>图书类型</th>
			<th>作者</th>
			<th>上架时间</th>
			<th>操作</th>
		</tr>
		<c:choose>
			<c:when test="${empty blist }">
				<tr>
					<td colspan="6" align="center">对不起，查不到此图书</td>
				</tr>
			</c:when>
			<c:otherwise>
				<c:forEach items="${blist }" var="vo">
					<tr>
						<td>${vo.bookname }</td>
						<td>${vo.publish}</td>
						<td>
							<c:if test="${vo.typeid eq '01' }">小说</c:if>
							<c:if test="${vo.typeid eq '02' }">儿童读物</c:if>
							<c:if test="${vo.typeid eq '03' }">专业书</c:if>
							<c:if test="${vo.typeid eq '04' }">经典著作</c:if>
							<c:if test="${vo.typeid eq '05' }">社会科学</c:if>
							<c:if test="${vo.typeid eq '06' }">生活休闲</c:if>
							<c:if test="${vo.typeid eq '07' }">摄影绘画</c:if>
							<c:if test="${vo.typeid eq '08' }">教育</c:if>
						</td>
						<td>${vo.author }</td>
						<td>${vo.uptime }</td>
						<td>
							<a href="books.action?methodName=detailBooks&typeid=${vo.typeid }">查看</a>
							<a href="books.action?methodName=toUpdateBooks&typeid=${vo.typeid }">修改</a>
							<a onclick="return confirm('确认要删除该图书吗？');" href="books.action?methodName=doDeleteBooks&typeid=${vo.typeid }">删除</a>
						</td>
					</tr>
				</c:forEach>
			</c:otherwise>
		</c:choose>
		<tr>
			<td colspan="6" align="center">
				<input type="submit" value="新增图书信息">
			</td>
		</tr>
	</table>
</form>
</body>
<script type="text/javascript">
	$(function() {
		$("input[type='button']").click(function() {
			$("form").attr("action","books.action?methodName=doListBooks").submit();
		});
	});
</script>
</html>